Introduction to Network Protocols By The Weasel Introduction This tutorial will hopefully be able to introduce you to the world of network protocols with emphasis on TCP. This tutorial is really very basic. This assumes you know next to nothing about protocols. If you REALLY want to get in-depth info on TCP go and buy a book (or get one from the library!) and read it cover-to-cover. I recommend TCP/IP Illustrated from Addison Wesley. Types of protocols There are two main types of protocols used in networks today. Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). I should probably tell you the "dictionary" definition of TCP and UDP, but it is fairly meaningless. IP (Internet Protocol) will also be introduced here for reference on TCP/IP, which will be discussed later. UDP is based on what some people might call a "connection-less" protocol. This means that when a user opens up a port, no login is made and no hardware handshaking is performed. UDP is easier to use for the reason that it is simpler, but errors are common and connections can easily be terminated. This also explains why UDP is much less common than TCP. TCP, on the other hand, is connection based. It supports 3-way hardware handshaking, packet verification, and usually requires a login/password to enter the network. TCP is responsible for breaking up messages into datagrams and reassembling them in the right order at the other end. The main difference between the two protocols is that UDP puts the data to be exchanged in part of the message, while TCP sets up the connection first. The main similarity is that both protocols require the user to open up a port to communicate. IP is a protocol that is used with TCP to make TCP/IP, the standardized Internet protocol. IP can be said to be simply a set of routines and commands used by TCP, but this is not all IP does. IP is also responsible for the routing of the actual datagrams created by TCP. On a local network, IP would not be needed because most routing is a simple job. But on the Internet, things are much more complicated. Data can travel through hundreds of different machines before reaching its destination. This is why the Internet-Gods gave us IP. Ports and Sockets Ports are the basis for most client/server relationships and it is very important you understand them. Think of ports as an easy way for the computer to know what applications are being run. For example, if you are running an HTTP server, you would most likely run it on port 80. This means that if a user with the correct client opens up port 80 from your server, a connection will be established and data will begin flowing. In most cases, servers will run standard ports for networking functions. Ports 1 to 255 are generally used for local services, but there are exceptions. Both machines involved in each connection maintain a list of active ports on a particular IP address. Each two-way connection to a certain port is identified by what is called a socket. A socket is made up of the IP address of the machine and the port number in use. There are sockets on both ends of the connection making sure the data being sent and received doesn't get lost. Because both machines have unique IP addresses and ports, the sockets are unique. TCP/IP TCP/IP is the standard protocol for the Internet. TCP/IP is "layered" which means different protocols "sit" on TCP/IP. For example, there is a protocol for the www called HTTP. This protocol defines the type of info being sent/received and how that info is processed. However, for the two computers to communicate with each other, it needs a standard, separate protocol. This is where TCP/IP comes in. TCP/IP sets a standard for Internet computers that allows ANY two computers to communicate with each other. TCP/IP in itself can even be divided up into two protocols. TCP was discussed earlier, but IP (Internet Protocol) is also needed. As I said before, IP is a library of routines and commands that TCP can call on to make communicating easier and more efficient, as TCP by itself is not very good by itself for standardized Internet communications. Other Protocols There is another protocol I should mention called ICMP. (Internet Control Message Protocol) ICMP is used for basic Internet functions such as error messages and ping. ICMP is the simplest of all the protocols since all ICMP info can fit into one datagram. Error messages such as, "Host is not responding" are sent through ICMP. Conclusion I hope that I have explained better how protocols on the Internet work. I may continue with a more in-depth look at TCP/IP, but it depends on the feedback I get on this article. The Weasel